package test5;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.util.Iterator;

public class Simple {

    public static void main(String[] args) {
        SAXReader sr = new SAXReader();
        Document doc = null;
        try {
             doc = sr.read(new File("F:\\IDEACodeOFJavaEE\\XMLStudy\\src\\test5\\goods.xml"));
            Element root = doc.getRootElement();
            Iterator<Element> it  = root.elementIterator();
            while (it.hasNext()){
                Element element = it.next();

                System.out.println(element.toString());
                Iterator<Element> el = element.elementIterator();
                while (el.hasNext()){
                    Element element1 = el.next();
                    System.out.println(element1.getText());
                }
            }
        } catch (DocumentException e) {
            e.printStackTrace();
        }
    }
}
